package cn.iocoder.yudao.framework.common.enums;

import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 全局燃气户类型枚举
 */
@AllArgsConstructor
@Getter
public enum CrmUserTypeEnum implements IntArrayValuable {

    RESIDENT(0, "居民"), //
    BUSINESS(1, "商业"), //
    INDUSTRY(2, "工业"), //
    BUSSERVER(3, "商服"); //

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CrmUserTypeEnum::getValue).toArray();

    /**
     * 类型
     */
    private final Integer value;
    /**
     * 类型名
     */
    private final String name;

    public static CrmUserTypeEnum valueOf(Integer value) {
        return ArrayUtil.firstMatch(userType -> userType.getValue().equals(value), CrmUserTypeEnum.values());
    }

    @Override
    public int[] array() {
        return ARRAYS;
    }
}
